'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 1_study_llm_bind_params.py
* @Time: 2025/10/24
* @All Rights Reserve By Brtc
'''
import dotenv
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

dotenv.load_dotenv()
prompt = ChatPromptTemplate.from_messages([
    ("system", "你正在执行一项测试,请重复用户输入的内容,除了重复，不要有其他废话！"),
    ("human","用户输入的内容:{query}")
])
llm = ChatOpenAI(model="gpt-4o-mini")
#chain = prompt|llm.bind(stop="world")|StrOutputParser()
chain = prompt|llm|StrOutputParser()
content = chain.invoke({"query":"hello world"})
print(content)